package org.linlinjava.litemall.admin.controller;

import org.linlinjava.litemall.admin.beans.annotation.LogAnno;
import org.linlinjava.litemall.admin.beans.annotation.LoginAdminShopId;
import org.linlinjava.litemall.admin.service.ShopLogService;
import org.linlinjava.litemall.core.validator.Order;
import org.linlinjava.litemall.core.validator.Sort;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 管理店铺日志控制器
 *
 * @author yliyun
 * @Author: robb
 * @Date: 2019/11/15 11:25
 * @Version: 1.0
 * @Description: 门店操作日志controller
 * @date 2022/09/14
 */

@RestController
@RequestMapping("/admin/shopLog")
@Validated
public class AdminShopLogController {

    /**
     * 商店日志服务
     */
    @Autowired
    private ShopLogService shopLogService;

    /**
     * 列表
     * 查询门店操作日志
     *
     * @param content 内容
     * @param shopId  商店id
     * @param page    页面
     * @param limit   限制
     * @param sort    排序
     * @param order   订单
     * @return {@link Object}
     */
    @GetMapping("/list")
    @LogAnno
    public Object list(String content,
                       @LoginAdminShopId Integer shopId,
                       @RequestParam(defaultValue = "1") Integer page,
                       @RequestParam(defaultValue = "10") Integer limit,
                       @Sort @RequestParam(defaultValue = "add_time") String sort,
                       @Order @RequestParam(defaultValue = "desc") String order) {
        return shopLogService.list(shopId, content, page, limit, sort, order);
    }

}
